package lelouet.datacenter.simulation;

import lelouet.datacenter.simulation.events.AEvent;
import lelouet.datacenter.simulation.factorized.WorkingElement;

/**
 * An VM has some work to do, and an advance on this work<br />
 * basically, it has too a request for a minimum number of MIPS, and a number of
 * MIPS after which it cannot compute faster; plus, a required and optimal size
 * for memory. A VM can produce {@link AEvent} at the end of time slots (which
 * are in ms) <br />
 * note that the {@link #equals(Object)} and {@link #hashCode()} are defined on
 * the {@link #getId()}
 * 
 * @author lelouet
 */
public interface VM extends WorkingElement, PhysicalRequirements {

	/** @return the last CPU that was allocated, in MIPS */
	public long getAllocatedCPU();

	/**
	 * Set the quantity of CPU allocated to this for the next work
	 * 
	 * @param MIPS
	 *            the CPU capacity, in MIPS, allocated to the VM
	 */
	public void setAllocatedCPU(long MIPS);

	public long getWeightCPU();

	public void setCPUWeight(long weight);

	/**
	 * gives ram to this
	 * 
	 * @param mo
	 *            the size of memory, in Mo, that this has been allocated
	 */
	public void allocateMemory(long mo);

	/**
	 * set the present time. This can lead to events happening since last time
	 * and present time, that are as such returned
	 * 
	 * @param timems
	 *            the present time in ms.
	 */
	public void setTime(long timems);

}
